package com.it.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;

@AllArgsConstructor
@NonNull
@NoArgsConstructor
@Data
public class ResponseResult<T> {
    private int code;
    private String msg;
    private T data;

    public static <T> ResponseResult<T> success(T data) {
        ResponseResult<T> result = new ResponseResult<>();
        result.setCode(200);
        result.setMsg("success");
        result.setData(data);
        return result;
    }

    public static <T> ResponseResult<T> error(String msg) {
        ResponseResult<T> result = new ResponseResult<>();
        result.setCode(500);
        result.setMsg(msg);
        return result;
    }

    // getters and setters
}